package br.com.tcf.filtros;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;

@WebFilter(urlPatterns="/*")
public class FilterOpenSessionInView implements Filter {

//	private Session session;
	@Override
	public void doFilter(ServletRequest request, ServletResponse response,	FilterChain chain) throws IOException, ServletException {
		
		chain.doFilter(request, response);

//		System.out.println("Executou o Filtro: "+request.getAttribute("session"));
//
//		session = (Session)request.getAttribute("session");
//		if(session!=null){
//			session.disconnect();
//			session.close();
//			session = null;			
//		}
//		System.out.println("Executou o Filtro: "+request.getAttribute("session"));
	}

	@Override
	public void destroy() {
		// TODO Auto-generated method stub

	}
	@Override
	public void init(FilterConfig arg0) throws ServletException {
		// TODO Auto-generated method stub

	}
}
